<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<script type="text/javascript">
    function equipmentTypeDelete(id) {
        if (confirm("确定要删除这条记录吗?")) {
            $.post("${pageContext.request.contextPath}/equipmentType/delete.do", {id: id},
                function (result) {
                    var result = eval('(' + result + ')');
                    if (result.errorInfo) {
                        alert(result.errorInfo);
                    } else {
                        alert("删除成功");
                        window.location.href = "${pageContext.request.contextPath}/equipmentType/list.do";
                    }
                }
            );
        }
    }
</script>
<div class="row search">
    <div class="col-md-6">
        <form action="${pageContext.request.contextPath}/equipmentType/list.do" method="post">
            <div class="input-group" style="width: 300px">
                <input type="text" class="form-control" name="typeName" value="${s_equipmentType.typeName }" placeholder="请输入要查询的设备类型...">
                <span class="input-group-btn">
                    <button class="btn btn-default" type="submit"><span class="glyphicon glyphicon-search"></span>&nbsp;查询</button>
                </span>
            </div>
        </form>
    </div>
    <div class="col-md-6">
        <button type="button" class="btn btn-primary" style="float: right;" onclick="window.location.href='${pageContext.request.contextPath}/equipmentType/preSave.do'">添加</button>
    </div>
</div>
<div>
    <table class="table table-hover  table-bordered table-striped" style="margin-bottom: 0px;">
        <tr>
            <th>序号</th>
            <th>设备类型名称</th>
            <th>设备类型备注</th>
            <th>操作</th>
        </tr>
        <c:forEach var="equipmentType" items="${equipmentTypeList }" varStatus="status">
            <tr>
                <td>${status.index+1 }</td>
                <td>${equipmentType.typeName }</td>
                <td>${equipmentType.remark }</td>
                <td>
                    <button type="button" class="btn btn-info btn-xs" onclick="window.location.href='${pageContext.request.contextPath}/equipmentType/preSave.do?id=${equipmentType.id }'">修改</button>
                    <button type="button" class="btn btn-danger btn-xs" onclick="equipmentTypeDelete(${equipmentType.id })">删除</button>
                </td>
            </tr>
        </c:forEach>
    </table>
    <nav>
        <ul class="pagination">
            ${pageCode }
        </ul>
    </nav>
</div>



